﻿using Corina.Datamodel.Base;
using Corina.Datamodel.Interface;
using Corina.Enumerations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace Corina.Datamodel.Entities
{
    [XmlTypeAttribute(Namespace = "http://tempuri.org/")]
    public class MessageSendInfo : DatamodelEntity, IMessageSend
    {
        #region Fields
        private int _id;
        private string _guid = System.Guid.NewGuid().ToString();
        private int _userId = 0;
        private string _content;
        private DateTime _submitTime = DateTime.Now;
        private DestTypeValue _sendWay = DestTypeValue.Email;
        #endregion

        #region Properties
        public int Id
        {
            get { return _id; }
            set
            {
                _id = value;
                RaisePropertyChanged(() => Id);
            }
        }
        public string Guid
        {
            get { return _guid; }
            set
            {
                _guid = value;
                RaisePropertyChanged(() => Guid);
            }
        }
        public int UserId
        {
            get { return _userId; }
            set
            {
                _userId = value;
                RaisePropertyChanged(() => UserId);
            }
        }
        public string Content
        {
            get { return _content; }
            set
            {
                _content = value;
                RaisePropertyChanged(() => Content);
            }
        }
        public DateTime SubmitTime
        {
            get { return _submitTime; }
            set
            {
                _submitTime = value;
                RaisePropertyChanged(() => SubmitTime);
            }
        }

        public DestTypeValue SendWay
        {
            get { return _sendWay; }
            set
            {
                _sendWay = value;
                RaisePropertyChanged(() => SendWay);
            }
        }
        #endregion

        protected override IEnumerable<DatabaseColumn> InitColumns()
        {
            yield return new DatabaseColumn("Id", true);
            yield return new DatabaseColumn("Guid");
            yield return new DatabaseColumn("UserId");
            yield return new DatabaseColumn("Content");
            yield return new DatabaseColumn("SubmitTime");
            yield return new DatabaseColumn("SendWay");
        }
    }
}